<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@include file="../common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>编辑会员等级</title>
		<link type="text/css" href="${ctx}/css/style.css" rel="stylesheet" />
		<link type="text/css" href="${ctx}/css/forms.css" rel="stylesheet" />
		<link type="text/css" href="${ctx}/js/validate/jquery.validate.css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
		<script type="text/javascript" src="${ctx}/js/validate/jquery.validate.js"></script>
		<script type="text/javascript" src="${ctx}/js/validate/messages_cn.js"></script>
		<script type="text/javascript" src="${ctx}/js/common.js"></script>
		<script type="text/javascript">
			
			
			$(function() {
				$("#inputForm").validate({
					rules: {
						name: {
							required: true,
							maxlength: 50
						},
						desc: {
							maxlength: 100
						}
					},
					submitHandler : function(form) {
						if ("${id}" == "") {
							var data = $.ajax({
								url : "${ctx}/userlevel/user_level!nameExists.action?userLevel.name=" + $("#name").val(),
								async : false,
								cache : false
							}).responseText;
							if (data == "true") {
								alert("产品名称已经存在");
								return false;
							}
						}
				       form.submit();
				    }
				});
			});
		</script>
	</head>
	<body>
		<form id="inputForm" action="${ctx}/userlevel/user_level!save.action" method="post" name="form">
			<s:hidden name="id" />
			<div class="titleDiv">
				<h1>产品信息</h1>
			</div>
			<table border="0" cellpadding="0" cellspacing="0" class="bg1_1" width="96%" style="margin-left: 30px">
				<tr>
					<td width="100" height="30" align="left">等级名称<span class="red">*</span></td>
					<td><input id="name" name="levelName" value="${levelName}"${!empty id ? ' disabled' : ''} style="width: 30%;" /></td>
				</tr>
				<tr>
					<td width="100" height="30" align="left">等级描述</td>
					<td colspan="3"><textarea id="desc" style="width:58%" name="levelDesc">${levelDesc}</textarea></td>
				</tr>
			</table>
			<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top: 20px;">
				<tr>
					<td height="40" colspan="4" align="center">
						<input type="submit" value="保存 " />
						<input type="button" value="返回" onclick="history.go(-1);" />
				</tr>
			</table>
		</form>
	</body>
</html>